<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>My JSP 'edit_sys_user_info.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="${ctx }/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="${ctx }/css/font-awesome.css?v=4.4.0" rel="stylesheet">

<!-- jqgrid-->
<link href="${ctx }/css/plugins/jqgrid/ui.jqgrid.css?0820"
	rel="stylesheet">

<link href="${ctx }/css/animate.css" rel="stylesheet">
<link href="${ctx }/css/style.css?v=4.1.0" rel="stylesheet">
<link
	href="${ctx}/css/plugins/bootstrap-select/bootstrap-select.min.css"
	rel="stylesheet" />
<!-- bootstrap-switch css -->
<link href="${ctx }/css/plugins/bootstrap-switch/bootstrap-switch.css"
	rel="stylesheet">
<style type="text/css">
body {
	background: none;
}
</style>
</head>
<body>

<div class="inmodal"  role="dialog" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content animated bounceInRight">
			<div class="modal-header">
					<button type="button" class="close closeWin" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
					</button>
					<h5 class="modal-title">编辑业务场景配置</h5>
				</div>
				<div class="ibox-content">
					<form class="form-horizontal m-t" name="editSceneFrom" id="editSceneFrom">
						<input type="hidden" name="pk_scene_id" id="pk_scene_id" value="${moint_scene_base.pk_scene_id}">
						<div class="form-group">
							<label class="col-sm-3 control-label">场景名称：</label>
							<div class="col-sm-8">
								<input id="scene_name" name="scene_name" class="form-control"
									required="" aria-required="true" type="text" value="${moint_scene_base.scene_name}">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">管理部门：</label>
							<div class="col-sm-8">
								<select class="selectpicker" required="" aria-required="true"
									name="org_id" id="org_id">
									<option value="">--请选择--</option>
									<c:forEach items="${olist}" var="orgInfo">
										<option value="${orgInfo.org_id}" <c:if test="${moint_scene_base.org_id==orgInfo.org_id }">selected</c:if> >${orgInfo.org_name}</option>
									</c:forEach>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">监控开关：</label>
							<div class="col-sm-2">
								<div class="switch has-switch">
									<div id="share_switch_div" class="switch-on switch-animate">
										<input id="share_switch_input" name="share_switch_input"
											type="checkbox" checked="checked">
									</div>
								</div>
								<input id="scene_status" name="scene_status" type="hidden">
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">                                   
                                    <button type="button" class="btn btn-white closeWin" data-dismiss="modal">关闭</button>
                					<button type="submit"  class="btn btn-primary">保存</button>
                            </div>
                   		</div>
					</form>
				</div>
		</div>
	</div>
</div>
<!-- 全局js -->
<script src="${ctx }/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctx }/js/bootstrap.min.js?v=3.3.6"></script>

<!-- Peity -->
<script src="${ctx }/js/plugins/peity/jquery.peity.min.js"></script>

<!-- jqGrid -->
<script src="${ctx }/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
<script src="${ctx }/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

<!-- jQuery Validation plugin javascript-->
<script src="${ctx }/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${ctx }/js/plugins/validate/messages_zh.min.js"></script>

<!-- layer javascript -->
<script src="${ctx }/js/plugins/layer/layer.min.js"></script>

<!-- jQuery form-->
<script src="${ctx }/js/jquery.form.js"></script>

<!-- 自定义js ---->
<script src="${ctx }/js/content.js?v=1.0.0"></script>
<script src="${ctx }/js/plugins/layer/laydate/laydate.js"></script>
<script
		src="${ctx}/js/plugins/bootstrap-select/bootstrap-select.min.js"></script>
<!-- bootstrap-switch js -->
<script src="${ctx }/js/plugins/bootstrap-switch/bootstrap-switch.js"></script>
<script type="text/javascript">
	//绑定修改表单提交事件,异步提交表单
	$('.closeWin').click(function() {
		window.parent.editWinClose('1');
	});
	$("#editSceneFrom").submit(function(){
		$.ajax({
			type : "post",
			url : "${ctx }/monit/doEditScene",
			data : $('#editSceneFrom').serialize(),
			datatype : "json",
			success : function(data) {
				 if (data.errcode == '0') {
					layer.alert(data.errmsg, {
						icon : 1
					}, function(index) {
						
						window.parent.editWinClose('0');
						//关闭提示框
					});
				} else {
					layer.alert("保存失败！", {
						icon : 2
					});
				}  
			}
		});
		
		return false;
	}); 
	var v_scene_status ="${moint_scene_base.scene_status}";
	var v_switch;
	if(v_scene_status==1){
		v_switch=true;
	}else{
		v_switch=false;
	}
	//监控开关
	$('#share_switch_div input').bootstrapSwitch({
		onText : "ON",
		offText : "OFF",
		onColor : "primary",
		offColor : "danger",
		size : "small",
		state : v_switch,
		onInit : function(event, state) {//初始化开关
			$("#scene_status").val(v_scene_status);
		},
		onSwitchChange : function(event, state) {//开关状态发生改变时
			if (state == true) {
				$("#scene_status").val("1");
			} else {
				$("#scene_status").val("0");
			}
		}
	});
</script>
</body>
</html>
